#ifndef _CONVEXHULL_H
#define _CONVEXHULL_H

#include <iostream>
#include <cstdint>
#include <memory>
#include "cuda_base/cuda_base.h"
#include "module_base/util.h"
#include "obstacle_detector/convexhull_display.h"


namespace obstacle_detector
{
class ConvexHull
{
public:
	ConvexHull(bool debug);
	~ConvexHull();
	void get_convex_hull(const int16_t *points, int point_num,
		const uint8_t *points_label,int label_num,const module_base::Location &loc,
		std::vector<Eigen::MatrixXf> &objects_min_bbox);

private:
	void gen_init_gpu_value();

private:
	uint16_t *extreme_points_gpu_; //是否需要计算,16个极点 从最左边点开始 顺时针排序
	uint16_t *extreme_points_init_gpu_;
	uint8_t *split_label_gpu_;  //根据极点划分的区域
	uint16_t *dis2line_gpu_;
	uint16_t *minmax_dis2line_gpu_;
	uint16_t *minmax_dis2line_init_gpu_;
	float *all_bbox_gpu_;
	float *all_bbox_init_gpu_;
	float *min_bbox_cost_gpu_;
	float *all_bbox_cost_gpu_;
	float *min_bbox_gpu_;

	bool debug_;
	std::unique_ptr<ConvexHullDisplay> convexhull_display_;

};//class

}//namespace

#endif